#ifndef __PRINT_H__
#define __PRINT_H__

#include "Common.h"

typedef enum _LOG_LVL_e_ {
    LOG_LVL_DEBUG = 1,
    LOG_LVL_INFO,
    LOG_LVL_WARN,
    LOG_LVL_ERROR,
    LOG_LVL_FATAL,

    LOG_LVL_MAX,
} LOG_LVL_e;

#define LOG(level, prefix, format, ...) \
do { \
    AppPrint(level, "%s <%s %d> " format "\n", prefix, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
} while(0);

#define LOG_DEBUG(fmt, ...) LOG(LOG_LVL_DEBUG, "[D]", fmt, ##__VA_ARGS__);
#define LOG_INFO(fmt, ...)  LOG(LOG_LVL_INFO,  "[I]", fmt, ##__VA_ARGS__);
#define LOG_WARN(fmt, ...)  LOG(LOG_LVL_WARN,  "[W]", fmt, ##__VA_ARGS__);
#define LOG_ERROR(fmt, ...) LOG(LOG_LVL_ERROR, "[E]", fmt, ##__VA_ARGS__);
#define LOG_FATAL(fmt, ...) LOG(LOG_LVL_FATAL, "[F]", fmt, ##__VA_ARGS__);

extern void AppPrint(LOG_LVL_e level, const char* format, ...);
extern ULONG AppPrint_SetLevel(LOG_LVL_e level);

#endif
